package com.gtxd.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.gtxd.dao.IPatientinfoDao;

@Repository("patientinfoDao")
public class PatientinfoDao implements IPatientinfoDao {

	@Autowired
	public SessionFactory sessionFactory;

	public Session getCurrentSession() {
		return this.sessionFactory.getCurrentSession();
	}

	Session s;

	@Override
	public boolean deletebatch(Object object, String[] ids, String key) throws Exception {
		String hql = "delete from " + object.getClass().getSimpleName() + " o where o." + key + " in (:list)";

		return this.getCurrentSession().createQuery(hql).setParameterList("list", ids).executeUpdate() > 0 ? true
				: false;
	}

}
